package websimulator;

import java.io.IOException;
import java.util.ArrayList;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import buildings.Supermarket;

import calculations.TechniqueEquipment;

/**
 * Servlet implementation class BuildingType
 */
@WebServlet("/BuildingType")
public class BuildingType extends HttpServlet {
	private static final long serialVersionUID = 1L;
    private int people=0;
    private double area=0;
	private ArrayList<Double> _tempOut;
	private ArrayList<Double> _tempIn;
	private ArrayList<Double> _lys;
    private int whatEquipment = 0, numberOfGlassDoors;
    private double size;
    
    /**
     * @see HttpServlet#HttpServlet()
     */
    public BuildingType() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		
		String test = request.getParameter("eID");
		System.out.println(test);
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException 
	{
		// TODO Auto-generated method stub
		ArrayList<TechniqueEquipment> techs = new ArrayList<TechniqueEquipment>();
		Supermarket market = new Supermarket(people, area, _tempOut, _tempIn, _lys, 2, 1, 2);
		size = Double.parseDouble(request.getParameter("area"));
		System.out.println(size);
		System.out.println("HEEEEEEI!");
		response.setContentType("text/plain");
		response.getWriter().write(Double.toString(size));
		
		/*if (whatEquipment == 1)
		{
			size = Double.parseDouble(request.getParameter("area"));
			numberOfGlassDoors = Integer.parseInt(request.getParameter("numberOfDoors"));
			techs.add(market.calcWalkInFreezer(size, numberOfGlassDoors));
		}
		else if (whatEquipment == 2)
		{
			size = Double.parseDouble(request.getParameter("area"));
			numberOfGlassDoors = Integer.parseInt(request.getParameter("numberOfDoors"));
			techs.add(market.calcWalkInFreezer(size, numberOfGlassDoors));
		}		
		else if (whatEquipment == 3)
		{
			size = Double.parseDouble(request.getParameter("area"));
			numberOfGlassDoors = Integer.parseInt(request.getParameter("numberOfDoors"));
			techs.add(market.calcWalkInFreezer(size, numberOfGlassDoors));
		}
		else if (whatEquipment == 4)
		{
			size = Double.parseDouble(request.getParameter("area"));
			numberOfGlassDoors = Integer.parseInt(request.getParameter("numberOfDoors"));
			techs.add(market.calcWalkInFreezer(size, numberOfGlassDoors));
		}
		else if (whatEquipment == 5)
		{
			size = Double.parseDouble(request.getParameter("area"));
			numberOfGlassDoors = Integer.parseInt(request.getParameter("numberOfDoors"));
			techs.add(market.calcWalkInFreezer(size, numberOfGlassDoors));
		}
		*/
		

		
	}

}
